﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Adams.Admin.Business.Classifieds
{
    public static class Categories
    {
        public static Adams.Admin.DataTransfer.Classifieds.Categories.PageLoad PageLoad()
        {
            return DataAccess.Classifieds.Categories.PageLoad();
        }

        public static Adams.Admin.DataTransfer.Classifieds.Categories.GetType GetType(Adams.Admin.DataTransfer.Classifieds.Categories.GetTypeInput input)
        {
            return DataAccess.Classifieds.Categories.GetType(input);
        }

        public static Adams.Admin.DataTransfer.Classifieds.Categories.GetCategory GetCategory(Adams.Admin.DataTransfer.Classifieds.Categories.GetCategoryInput input)
        {
            return DataAccess.Classifieds.Categories.GetCategory(input);
        }

        public static DataTransfer.FormOutput SaveType(DataTransfer.Classifieds.Categories.TypeFormInput input)
        {
            var output = Validation.PerformBasicValidation(input);

            if (output.IsValid)
            {
                output.ID = DataAccess.Classifieds.Categories.SaveType(input);
                output.IsSaved = true;
            }

            return output;
        }

        public static DataTransfer.FormOutput SaveCategory(DataTransfer.Classifieds.Categories.CategoryFormInput input)
        {
            var output = Validation.PerformBasicValidation(input);

            if (output.IsValid)
            {
                output.ID = DataAccess.Classifieds.Categories.SaveCategory(input);
                output.IsSaved = true;
            }

            return output;
        }

        public static void DeleteType(int typeId)
        {
            DataAccess.Classifieds.Categories.DeleteType(typeId);
        }

        public static void DeleteCategory(int categoryId)
        {
            DataAccess.Classifieds.Categories.DeleteCategory(categoryId);
        }
    }
}
